package com.changgou.goods.api;

import com.changgou.common.entity.Result;
import com.changgou.goods.pojo.Category;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

import java.util.Map;

@Api(value = "分类表接口",description = "分类表分级目录")
public interface CategoryApi {
    /***
     * 查询所有
     * @return
     */
    @ApiOperation("查询所有分类列表")
    Result findAll();

    /**
     * 根据ID查询
     * @param id
     * @return
     */
    @ApiOperation("根据ID查询分类数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name="id",value = "分类ID",required=true,paramType="path",dataType="int"),
    })
    Result findById(Integer id);

    /***
     * 新增
     * @param category
     */
    @ApiOperation("新增分类")
    Result add(Category category);

    /***
     * 修改
     * @param category
     */
    @ApiOperation("修改分类")
    @ApiImplicitParams({
            @ApiImplicitParam(name="id",value = "分类ID",required=true, paramType = "path", dataTypeClass = Integer.class),
    })
    Result update(Category category,Integer id);

    /***
     * 删除
     * @param id
     */
    @ApiOperation("删除分类")
    @ApiImplicitParams({
            @ApiImplicitParam(name="id",value = "分类ID",required=true, paramType = "path", dataTypeClass = Integer.class),
    })
    Result delete(Integer id);

    /***
     * 多条件搜索
     * @param searchMap
     * @return
     */
    @ApiOperation("查询品牌列表")
    Result findList(Map<String, Object> searchMap);
    


    /***
     * 多条件分页查询
     * @param searchMap
     * @param page
     * @param size
     * @return
     */
    @ApiOperation("条件分页查询分类列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name="searchMap",value = "条件查询 JSON数据,分类名称"),
            @ApiImplicitParam(name="page",value = "页码",required=true,paramType="path",dataType="int"),
            @ApiImplicitParam(name="size",value = "每页记录数",required=true,paramType="path",dataType="int")
    })
    Result findPage(Map<String, Object> searchMap, int page, int size);


    /**
     * 根据父id查询
     * @param id
     * @return
     */
    @ApiOperation("条件分页查询分类列表奥利给!!!杠杠滴!!!")
    @ApiImplicitParams({
            @ApiImplicitParam(name="id",value = "分类ID",required=true, paramType = "path", dataTypeClass = Integer.class),
    })
    Result findByParentId(Integer id);
}
